package cn.edu.jou.cs.course.springboot.addersim.halfadder;

import cn.edu.jou.cs.course.springboot.addersim.Signal;

public class Adder {
    public Output add(Input input) {
        int augend = input.getAugend().getValue();
        int addend = input.getAddend().getValue();

        int sumValue = augend ^ addend;
        int carryValue = augend & addend;

        return new Output(Signal.valueOf(sumValue), Signal.valueOf(carryValue));
    }
}
